-
Notifications
You must be signed in to change notification settings - Fork 1.2k
linux/aarch64: make mcontext_t.__reserved pub #4823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
The `mcontext_t.__reserved` field is documented to contain extra context, such as FP state and the ESR register. This field is 16-byte aligned, so for simplicity expose it as an array of `u128` elements (similar to how `musl` defines it as an array of `long double`s in C).
|
Some changes occurred in the Android module cc @maurer |
|
Is there official documentation outside of the uapi comment saying what this field contains? The manpage I found says (link):
Given that and the fact that the field is actually named reserved, I am hesitant to expose this. If you actually need these fields and want to opt into whatever sort of instability they have, it would be better to define your own struct and transmute. |
tgross35
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(updating status)
The uapi header is the only documentation I am aware of. But uapi documents interfaces that are stable. I certainly agree that the If you search around (https://github.com/search?q=__reserved+uc_mcontext&type=code), you can find lots of C/C++ code accessing this field as documented in the uapi definitions. It should be possible to port such code to Rust without manually defining types. I suppose to really complete that promise, |
|
(I'll find another way to handle the u128 issue once you're convinced that this is otherwise a righteous change.) |
Description
The
mcontext_t.__reservedfield is documented to contain extra context, such as FP state and the ESR register. This field is 16-byte aligned, so for simplicity expose it as an array ofu128elements (similar to howmusldefines it as an array oflong doubles in C). This is OK becausealign_of::<u128>() == 16on aarch64 all the way back to MSRV (1.63).The other option is to expose it as
[u8; 4096]and to add explicit padding in the right place. I'm open to that approach, too.Sources
Checklist
libc-test/semverhave been updated*LASTor*MAXareincluded (see #3131)
cd libc-test && cargo test --target mytarget);especially relevant for platforms that may not be checked in CI
@rustbot label +stable-nominated